package com.ruoyi.controller.goods;

import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.model.TestInfo;
import com.ruoyi.service.TestService;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.annotation.Resource;

/**
 * 操作日志记录
 * 
 * @author ruoyi
 */
@Controller
@RequestMapping("/api/goods")
public class GoodsController extends BaseController
{
    @Resource
    private TestService testService;

    @PostMapping("/dao-add")
    @Log(title = "测试dao记录新增", businessType = BusinessType.INSERT)
    @ResponseBody
    public AjaxResult daoAdd(@RequestBody TestInfo request)
    {
        boolean result = testService.addTestInfo(request);
        if (result == true) {
            return AjaxResult.success();
        }else{
            return AjaxResult.error();
        }
    }

    @PostMapping("/mapper-add")
    @Log(title = "测试mapper记录新增", businessType = BusinessType.INSERT)
    @ResponseBody
    public AjaxResult mapperAdd(@RequestBody TestInfo request)
    {
        boolean result = testService.addTestInfoMapper(request);
        if (result == true) {
            return AjaxResult.success();
        }else{
            return AjaxResult.error();
        }
    }

}
